<template>
    <div class="article_create">
        <el-form :model="form">
            <el-form-item label="资讯标题">
                <el-input v-model="form.title"></el-input>
            </el-form-item>

            <el-form-item label="所属分类">
                <el-input v-model="form.categoryId"></el-input>
            </el-form-item>

            <el-form-item label="资讯内容">
                <el-input type="textarea" :rows="10" v-model="form.content"></el-input>
            </el-form-item>

            <el-form-item style="text-align:right">
                <el-button size="small" type="primary" @click="submit" >发布</el-button>
            </el-form-item>

        </el-form>

        <div style="text-align:center">
            <el-button size="small" type="primary"  @click="toBack">返回</el-button>
        </div>
    </div>
        

</template>

<script>
import {post} from '@/utils/request'
export default {
    mounted(){
        let article = this.$route.query;
        this.form = article
    },


    data(){
        return{
            form:{}
        }
    },


    methods:{
        toBack(){
            this.$router.go(-1);
        },

        submit(){
            let url = "http://cyjclub.top:8001/article/saveOrUpdate"
            post(url,this.form).then(resp =>{
                //提示
                this.$message({type:"success",message:resp.message})
                //跳转
                this.toBack();
            })
        } 
    }
    
}
</script>

<style scoped>

</style>